$(function () {
    setStage("test", "body", 800, 600);
    setStageBackGround("./img/back03.bmp");
    setStageText(780, 170, 420, 10, "rgba(0,0,0,0.5)");

    addBGM("./bgm/normal.ogg", "normal", true);
    addBGM("./bgm/normal2.ogg", "normal2", true);
    addBGM("./voice/004.ogg", "voice1");
    addBGM("./voice/005.ogg", "voice2");
    addBGM("./voice/006.ogg", "voice3");
    addBGM("./voice/007.ogg", "voice4");
    setText("点击鼠标开始游戏");
    var num = 0;
    $("#test").click(function () {
        num++;
        //当判断num为最后切换“树节点” 既进入event分支
        if (num > 8) {
            //根据用户选择不同的选项，导入分支线
            //$("#eventJs").attr("src","event/1A/1a.js");
            reloadAbleJSFn("eventJs","event/1A/1a.js");
        } else {
            exeFun("tsEvent", num);
        }
    })
});

function tsEvent(num) {
    if (num === 1) {
        appendImg("./img/tachi01a.png", "tebg1", 483, 600, 0, 158.3);
        setText("测试立绘")
    }

    if (num === 2) {
        delelem("tebg1");
        appendImg("./img/tachi01b.png", "tebg1", 483, 600, 0, 158.3);
        setText("测试更换立绘")
    }

    if (num === 3) {
        playBGM("normal");
        setText("循环播放BGM")
    }

    if (num === 4) {
        playBGM("voice1");
        setText("播放语音")
    }

    if (num === 5) {
        playBGM("voice1");
        setText("重新播放上一条")
    }

    if (num === 6) {
        stopBGM("voice1");
        playBGM("voice2");
        setText("播放另一个并停止前一个语音")
    }

    if (num === 7) {
        //后续需要考虑禁止鼠标点击文本框，要求必须选择选项

        addSelect("推倒她", ["tsEvent", ++num], "selt1", 400, 50, 150, 200, "rgba(0,0,0,0.4)", "rgba(0,0,0,0.8)")
        addSelect("抱住她", ["tsEvent", ++num], "selt2", 400, 50, 350, 200, "rgba(0,0,0,0.4)", "rgba(0,0,0,0.2)")
        setText("选择选项卡")
    }

    if (num === 8) {
        delelem("selt1");
        delelem("selt2");
        stopBGM("normal");
        playBGM("normal2");
        setText("循环播放BGM2");

    }
}